<form action="index.php" method="post" name="adminForm" id="adminForm">
<script type="text/javascript">
jQuery(document).ready(
  function(){
    <? if(!isset($this->stat)): ?>
      jQuery('#team_id').change();
    <? endif; ?>
    jQuery("#adminForm").validate({
      rules:  {
        final_score:{
          required: true,
          digits: true
        },
        field_goals:{
          required: true,
          digits: true
        },
        three_points:{
          required: true,
          digits: true
        },
        free_throws:{
          required: true,
          digits: true
        },
        off_rebounds:{
          required: true,
          digits: true
        },
        def_rebounds:{
          required: true,
          digits: true
        },
        assists:{
          required: true,
          digits: true
        },
        steals:{
          required: true,
          digits: true
        },
        blocks:{
          required: true,
          digits: true
        }
      }
    });
  }
);
</script>
  <fieldset class="adminform">
    <legend>Details</legend>
      <?
        $id         = 0;
        $schedule_id   = null;
        $team_id     = null;
        $final_score   = null;
        $is_overtime   = null;
        $field_goals   = null;
        $three_points   = null;
        $free_throws   = null;
        $off_rebounds   = null;
        $def_rebounds   = null;
        $assists     = null;
        $steals     = null;
        $blocks     = null;
        $published     = true;
        $schedules    = array();
        $teams          = array();
       
        if(isset($this->stat)){
          $id         = $this->stat->id;
          $schedule_id   = $this->stat->schedule_id;
          $team_id     = $this->stat->team_id;
          $final_score   = $this->stat->final_score;
          $is_overtime   = $this->stat->is_overtime;
          $field_goals   = $this->stat->field_goals;
          $three_points   = $this->stat->three_points;
          $free_throws   = $this->stat->free_throws;
          $off_rebounds   = $this->stat->off_rebounds;
          $def_rebounds   = $this->stat->def_rebounds;
          $assists     = $this->stat->assists;
          $steals     = $this->stat->steals;
          $blocks     = $this->stat->blocks;
          $published     = $this->stat->published;
        }
        
        if(isset($this->teams))
          $teams = $this->teams;
          
        if(isset($this->schedules))
          $schedules = $this->schedules;
        
      ?>
            <table class="admintable">
        <tr>
                    <td class="key">Team</td>
          <td>
            <? $schedule_link = "onchange=\"ajx_request('". JRequest::getVar('c', 'division') ."', 'ajx_select_scheds', 'team_id='+this.value , 'div_scheds');\""; ?>
            <?= JHTML::_('select.genericlist', $teams, 'team_id', $schedule_link, 'id', 'name', $team_id); ?>
          </td>
        </tr>
        <tr>
                    <td class="key">Schedule</td>
          <td>
            <div id="div_scheds">
            <?= JHTML::_('select.genericlist', $schedules, 'schedule_id', null, 'id', 'schedule', $schedule_id) ?>
            </div>
          </td>
        </tr>
        <tr>
                    <td class="key">Final Score</td>
          <td>
            <input type="text" name="final_score" id="final_score" value="<?= $final_score ?>" />
          </td>
        </tr>
        <tr>
                    <td class="key">Field Goals</td>
          <td>
            <input type="text" name="field_goals" id="field_goals" value="<?= $field_goals ?>" />
          </td>
        </tr>
        <tr>
                    <td class="key">3 Points</td>
          <td>
            <input type="text" name="three_points" id="three_points" value="<?= $three_points ?>" />
          </td>
        </tr>
        <tr>
                    <td class="key">Free Throws</td>
          <td>
            <input type="text" name="free_throws" id="free_throws" value="<?= $free_throws ?>" />
          </td>
        </tr>
        <tr>
                    <td class="key">Offensive Rebounds</td>
          <td>
            <input type="text" name="off_rebounds" id="off_rebounds" value="<?= $off_rebounds ?>" />
          </td>
        </tr><tr>
                    <td class="key">Defensive Rebounds</td>
          <td>
            <input type="text" name="def_rebounds" id="def_rebounds" value="<?= $def_rebounds ?>" />
          </td>
        </tr><tr>
                    <td class="key">Assists</td>
          <td>
            <input type="text" name="assists" id="assists" value="<?= $assists ?>" />
          </td>
        </tr>
        <tr>
                    <td class="key">Steals</td>
          <td>
            <input type="text" name="steals" id="steals" value="<?= $steals ?>" />
          </td>
        </tr>
        <tr>
                    <td class="key">Blocks</td>
          <td>
            <input type="text" name="blocks" id="blocks" value="<?= $blocks ?>" />
          </td>
        </tr>
        <tr>
                    <td class="key">Overtime</td>
          <td>
            <?= JHTML::_('select.booleanlist', 'is_overtime', 'class="inputbox"', $is_overtime); ?>
          </td>
        </tr>
        <tr>
          <td class="key">Published</td>
          <td>
            <?= JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $published); ?>
          </td>
        </tr>
             </table>
       </fieldset>
       <input type="hidden" name="option" value="<?= JRequest::getVar( 'option' );?>"/>
     <input type="hidden" name="c" value="<?= JRequest::getVar('c', 'position'); ?>" />
       <input type="hidden" name="id" value="<?= $id; ?>"/>
     <input type="hidden" name="pic_id" value="<?= $pic_id; ?>"/>
       <input type="hidden" name="task" value=""/>
</form>